﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Media.DirectShow.UI;

namespace System.Windows.Media.DirectShow.Filters
{
    public class AudioVisualization : BaseFilter, IUIElement
    {

        private AudioVisualizationControl control;

        public AudioVisualization(Visualization visualization)
        {
            control = new AudioVisualizationControl();
            control.Content = visualization;
            visualization.Filter = this;

            if (visualization is PeaksVisualization)
                this.InputPin = new AudioPeaksVisualizationInputPin(this, visualization as PeaksVisualization);
            else
                throw new NotSupportedException("This visualization is not supported");

            this.OutputPin = new AudioVisualizationOutputPin(this);

            this.Pins.Add(InputPin);
            this.Pins.Add(OutputPin);
        }

        public IPin InputPin { get; set; }
        public IPin OutputPin { get; set; }

        public override string Name
        {
            get { return "Audio visualization"; }
        }

        public Visualization Visualization
        {
            set { control.Content = value; }
        }

        #region IUIElement Members

        public UIElement UIElement
        {
            get { return control; }
        }

        #endregion
    }
}
